package com.chuangjiangx.member.basic.web.config;

import com.chuangjiangx.commons.SpringContext;
import com.chuangjiangx.dddbase.spring.SpringDomainRegistry;
import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.io.ClassPathResource;


/**
 * @author zhangquanquan on 2018/7/2.
 */
@Configuration
@Import({
        MybatisConfig.class,
        DruidConfig.class,
        RedisConfig.class,
        Swagger2Config.class
})
public class AppConfig {

    @Bean("springDomainRegistry")
    public SpringDomainRegistry springDomainRegistry() {
        return new SpringDomainRegistry();
    }

    @Bean
    public SpringContext springContext(){
        return new SpringContext();
    }

    @Bean
    public PropertiesFactoryBean configProperties() {
        ClassPathResource resource = new ClassPathResource("conf.properties");
        PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
        propertiesFactoryBean.setLocations(resource);
        return propertiesFactoryBean;
    }
}
